             package com.java.diagnostics.visualizer.recommender.memory;
             
             import com.java.diagnostics.visualizer.data.AggregateData;
             import com.java.diagnostics.visualizer.data.DataPoint;
             import com.java.diagnostics.visualizer.data.TupleData;
             import com.java.diagnostics.visualizer.parser.vgc.constants.VGCGCReasons;
             import com.java.diagnostics.visualizer.parser.vgc.constants.VGCGCScopes;
             import com.java.diagnostics.visualizer.recommender.Recommendation;
             import com.java.diagnostics.visualizer.recommender.RecommendationBase;
             import com.java.diagnostics.visualizer.recommender.util.RecommendationLabels;
             
             public class LookForJavaHeapExhaustion
               extends RecommendationBase
               implements Recommendation
             {
               public void recommend(AggregateData data)
               {
                 if (!isGenerational(data))
                 {
                   TupleData flatHeapAfterGC = data
                     .getTupleData("VGCLabels.free.flat.heap");
                   TupleData flatHeapAfterAll = data
                     .getTupleData("VGCLabels.free.flat.heap.after.all.gcs");
                   
                   TupleData reasons = data.getTupleData("VGCLabels.gc.reasons");
                   
                   TupleData scopes = data.getTupleData("VGCLabels.gc.scopes");
                   
                   if ((flatHeapAfterGC != null) && (!flatHeapAfterGC.isEmpty()) && 
                     (flatHeapAfterAll != null) && (!flatHeapAfterAll.isEmpty()) && 
                     (reasons != null) && (!reasons.isEmpty()) && (scopes != null) && 
                     (!scopes.isEmpty()))
                   {
                     DataPoint[] scopePoints = scopes.getDataPoints();
                     int reason = -1;
                     
                     for (DataPoint scope : scopePoints) {
                       int scopeValue = (int)scope.getRawY();
                       if (scopeValue == VGCGCScopes.GLOBAL_INT) {
                         DataPoint reasonPoint = reasons.getDataPoint(
                           scope.getSequenceUID());
                         if (reasonPoint != null) {
                           reason = (int)reasonPoint.getRawY();
                         }
                         
                         if (reason == VGCGCReasons.AF_INT) {
                           double freeAfterAllBytes = 0.0D;
                           double freeAfterGCBytes = 0.0D;
                           
                           DataPoint freeAfterGCPoint = flatHeapAfterGC.getDataPoint(
                             scope.getSequenceUID());
                           DataPoint freeAfterAllPoint = flatHeapAfterAll.getDataPoint(
                             scope.getSequenceUID());
                           
                           if (freeAfterGCPoint != null) {
                             freeAfterGCBytes = freeAfterGCPoint.getRawY();
                           }
                           
                           if (freeAfterAllPoint != null) {
                             freeAfterAllBytes = freeAfterAllPoint.getRawY();
                           }
                           
                           if (freeAfterAllBytes == freeAfterGCBytes) {
                             addProblem(
                               data, 
                               RecommendationLabels.JAVA_HEAP_EXHAUSTED);
                             suggestHeapSizes(data);
                             return;
                           }
                         }
                       }
                     }
                   }
                 }
               }
             }


